import axios from "@/utils/request.js";

/**
 * 添加获奖情况
 * @param {*} awardInfo 
 * @returns 
 */
export const awardAddService = (awardInfo) => {
    return axios.post("/awardResult/add",awardInfo)
}

/**
 * 分页查询获奖信息
 * @param {*} pageNo 
 * @param {*} pageSize 
 * @param {*} matchNameFuzzy 
 * @param {*} userNameFuzzy 
 * @param {*} teacherNameFuzzy 
 * @returns 
 */
export const awardSelectService = (pageNo,pageSize,matchNameFuzzy,userNameFuzzy,teacherNameFuzzy) => {
    return axios.get("/awardResult/loadDataList",{params:{
        pageNo,pageSize,matchNameFuzzy,userNameFuzzy,teacherNameFuzzy
    }})
}

/**
 * 根据awardId修改获奖信息
 * @param {*} awardInfo 
 * @returns 
 */
export const awardModifyService = (awardInfo) => {
    return axios.put("/awardResult/updateAwardResultByAwardId",awardInfo)
}

/**
 * 根据获奖id数组批量删除获奖信息
 * @param {*} list 
 * @returns 
 */
export const awardDeleteService = (list) => {
    return axios.post("/awardResult/deleteAwardResultByAwardId",list)
}

/**
 * 将当前查询到的所有获奖信息导出Excel表格
 * @param {*} pageNo 
 * @param {*} pageSize 
 * @param {*} matchNameFuzzy 
 * @param {*} userNameFuzzy 
 * @param {*} teacherNameFuzzy 
 * @returns 
 */
export const awardExportService = (pageNo,pageSize,matchNameFuzzy, userNameFuzzy, teacherNameFuzzy) => {
    return axios({
      url: "/awardResult/downloadExcel", // 后端提供文件的URL
      method: 'GET',
      responseType: 'blob', // 确保响应类型为blob
      params: {
          pageNo,
          pageSize,
          matchNameFuzzy,
          userNameFuzzy,
          teacherNameFuzzy
      }
    })
}
